<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateStatOnlineLogTable extends Migration
{
    protected $connection = 'stat';

    public function up(): void
    {
        Schema::create('stat_online_log', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('stat_ts')->default(0)->comment('统计时间戳');
            $table->integer('online_num')->default(0)->comment('在线总人数');
            $table->integer('online_user_num')->default(0)->comment('在线普通用户数');
            $table->integer('online_host_num')->default(0)->comment('在线主播数');
            $table->integer('online_male_num')->default(0)->comment('在线男用户数');
            $table->integer('online_female_num')->default(0)->comment('在线女用户数');
            $table->timestamps();
            $table->tinyInteger('flag')->default(1)->comment('记录状态');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('stat_online_log');
    }
}
